
#ifndef  _PROGRESS_H
#define  _PROGRESS_H

/*打印的字符颜色定义*/
#define  BLACK   	   "\033[30m"
#define  RED     	   "\033[31m"
#define  GREEN   	   "\033[32m"
#define  YELLOW  	   "\033[33m"
#define  BLUE   	   "\033[34m"
#define  WHITE  	   "\033[37m"
#define  NONE      	   "\033[0m"

/*打印的字符背景颜色定义*/
#define  BACK_BLACK   	   "\033[40m"
#define  BACK_RED     	   "\033[41m"
#define  BACK_GREEN   	   "\033[42m"
#define  BACK_YELLOW  	   "\033[43m"
#define  BACK_BLUE   	   "\033[44m"
#define  BACK_WHITE  	   "\033[47m"

/*光标设置*/
#define  SET_LEFT(x)   		printf("\033[%dD",(x))
#define  SET_RIGHT(x)  		printf("\033[%dC",(x))
#define  SET_DOWN(x)   		printf("\033[%dB",(x))
#define  SET_POSITION(x,y) 	printf("\033[%d;%dH",(y),(x))
#define  SAVE_POSITON(void) 		printf("\033[s")
#define  RECOVER_POSITION(void)		printf("\033[u")
#define  FLIKER_CURSOR(void)		printf("\033[5m")
#define  NONE_CURSOR(void)			printf("\033[0m")
#define  CLEAN_LINE    "\033[K"
#define  REVERSE_SHOW  "\033[7m"
#define  HIGH_LIGHT	   "\033[?25h"
#define  LOW_LIGHT	   "\033[?25l"



struct progress_bar {
	int position_x;
	int position_y;
	int length;
	int wide;
	char* outline_color;
	char* inside_color;
};

extern int init(struct progress_bar *progress_bar);
extern int run(struct progress_bar *progress_bar);
extern void destroy(void);
extern int show_outline(struct progress_bar *progress_bar);
extern int show_progress(struct progress_bar *progress_bar, int percent);

#endif

